package com.cwf.security.service.impl;

import com.cwf.security.dao.PermissionListDao;
import com.cwf.security.entity.Permission;
import com.cwf.security.service.PermissionListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class PermissionListServiceImpl implements PermissionListService {

    @Autowired
    PermissionListDao permissionListDao;

    @Override
    public List<String> permissionList(String uid) {
        List<Permission> permissionList = permissionListDao.accessList(uid);

        List<String> list = permissionList.stream()
                .map(Permission::getMark)
                .collect(Collectors.toList());

        return  list;

    }
}
